package com.zw.yzk.kabu.utils;

import android.content.Context;

import com.google.gson.Gson;
import com.zw.yzk.kabu.model.DistrictModel;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by zhanwei on 2017/3/11.
 */

public class CityUtils {
    public static DistrictModel[] getLocalCityList(Context context) {
        InputStream inputStream = null;
        try {
            inputStream = context.getAssets().open("city/city.json");
            int size = inputStream.available();
            byte[] buffer = new byte[size];
            inputStream.read(buffer);
            inputStream.close();
            String tmp = new String(buffer);
            return new Gson().fromJson(tmp, DistrictModel[].class);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
